package com.chenjun.core.dao.generator.mapper;

import com.chenjun.core.dao.generator.entity.SysUser;
import com.chenjun.core.dao.generator.entity.SysUserExample;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface SysUserMapper {
    @Delete({
        "delete from sys_user",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String id);

    @Insert({
        "insert into sys_user (id, user_name, ",
        "real_name, password, ",
        "salt, disabled, ",
        "user_num, sex, area, ",
        "position_num, position_name, ",
        "position_level, phone, ",
        "address, birthday, ",
        "entry_time, img_url, ",
        "education, dimission_status, ",
        "equipment_num, email, ",
        "department, is_delete, ",
        "user_type, created_time, ",
        "update_time, office_id)",
        "values (#{id,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR}, ",
        "#{realName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, ",
        "#{salt,jdbcType=VARCHAR}, #{disabled,jdbcType=VARCHAR}, ",
        "#{userNum,jdbcType=VARCHAR}, #{sex,jdbcType=VARCHAR}, #{area,jdbcType=VARCHAR}, ",
        "#{positionNum,jdbcType=VARCHAR}, #{positionName,jdbcType=VARCHAR}, ",
        "#{positionLevel,jdbcType=CHAR}, #{phone,jdbcType=VARCHAR}, ",
        "#{address,jdbcType=VARCHAR}, #{birthday,jdbcType=VARCHAR}, ",
        "#{entryTime,jdbcType=TIMESTAMP}, #{imgUrl,jdbcType=VARCHAR}, ",
        "#{education,jdbcType=VARCHAR}, #{dimissionStatus,jdbcType=VARCHAR}, ",
        "#{equipmentNum,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, ",
        "#{department,jdbcType=VARCHAR}, #{isDelete,jdbcType=CHAR}, ",
        "#{userType,jdbcType=VARCHAR}, #{createdTime,jdbcType=TIMESTAMP}, ",
        "#{updateTime,jdbcType=TIMESTAMP}, #{officeId,jdbcType=VARCHAR})"
    })
    int insert(SysUser record);

    int insertSelective(SysUser record);

    List<SysUser> selectByExample(SysUserExample example);

    @Select({
        "select",
        "id, user_name, real_name, password, salt, disabled, user_num, sex, area, position_num, ",
        "position_name, position_level, phone, address, birthday, entry_time, img_url, ",
        "education, dimission_status, equipment_num, email, department, is_delete, user_type, ",
        "created_time, update_time, office_id",
        "from sys_user",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    @ResultMap("BaseResultMap")
    SysUser selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(SysUser record);

    @Update({
        "update sys_user",
        "set user_name = #{userName,jdbcType=VARCHAR},",
          "real_name = #{realName,jdbcType=VARCHAR},",
          "password = #{password,jdbcType=VARCHAR},",
          "salt = #{salt,jdbcType=VARCHAR},",
          "disabled = #{disabled,jdbcType=VARCHAR},",
          "user_num = #{userNum,jdbcType=VARCHAR},",
          "sex = #{sex,jdbcType=VARCHAR},",
          "area = #{area,jdbcType=VARCHAR},",
          "position_num = #{positionNum,jdbcType=VARCHAR},",
          "position_name = #{positionName,jdbcType=VARCHAR},",
          "position_level = #{positionLevel,jdbcType=CHAR},",
          "phone = #{phone,jdbcType=VARCHAR},",
          "address = #{address,jdbcType=VARCHAR},",
          "birthday = #{birthday,jdbcType=VARCHAR},",
          "entry_time = #{entryTime,jdbcType=TIMESTAMP},",
          "img_url = #{imgUrl,jdbcType=VARCHAR},",
          "education = #{education,jdbcType=VARCHAR},",
          "dimission_status = #{dimissionStatus,jdbcType=VARCHAR},",
          "equipment_num = #{equipmentNum,jdbcType=VARCHAR},",
          "email = #{email,jdbcType=VARCHAR},",
          "department = #{department,jdbcType=VARCHAR},",
          "is_delete = #{isDelete,jdbcType=CHAR},",
          "user_type = #{userType,jdbcType=VARCHAR},",
          "created_time = #{createdTime,jdbcType=TIMESTAMP},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "office_id = #{officeId,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(SysUser record);
}